# \api\fm\__init__.py
# 导入模块便于alembic 加载表 创建表
import importlib
import pkgutil


def init_model():
    package = __import__(__package__, fromlist=[''])
    submodules = [name for _, name, _ in pkgutil.iter_modules(package.__path__)]
    for submodule_name in submodules:
        try:
            # 动态导入子模块
            importlib.import_module(f"{__package__}.{submodule_name}")
        except Exception as e:
            print(f"Error importing submodule {submodule_name}: {e}")


init_model()
